﻿@inherits BaseComponent

<CmsCard Class="cl-rank" Icon="far fa-fire" Title="交流榜">
    @if (posts == null || posts.Count == 0)
    {
        <AntEmpty />
    }
    else
    {
        var index = 0;
        foreach (var item in posts)
        {
            index++;
            <div class="cl-rank-item">
                <div class="@($"index index{index}")">@index</div>
                <div class="title">
                    <a class="ask-title" href="@Url.GetBbsPostUrl(item.Id)">@item.Title</a>
                </div>
            </div>
        }
    }
</CmsCard>

@code {
    private List<PostListInfo> posts = [];

    [Parameter] public ISiteService Service { get; set; }

    protected override async Task OnInitAsync()
    {
        await base.OnInitAsync();
        posts = await Service.GetRankPostsAsync(ContentType.Interact);
    }
}